package com.im.entity;

import com.alibaba.fastjson2.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.*;
import java.time.LocalDateTime;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;

/**
 * 私聊消息实体
 *
 * @author im
 * @since 2025-02-14
 */
@Data
@Schema(description = "私聊消息实体")
@TableName("im_private_message")
public class ImPrivateMessage implements Serializable {

    private static final long serialVersionUID = 1L;

    @Schema(description = "雪花ID")
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private Long id;

    @Schema(description = "自增消息ID")
    @TableField("message_id")
    private Long messageId;

    @Schema(description = "发送者ID")
    @TableField("sender_id")
    private Integer senderId;

    @Schema(description = "接收者ID")
    @TableField("receiver_id")
    private Integer receiverId;

    @Schema(description = "会话ID")
    @TableField("session_id")
    private Long sessionId;

    @Schema(description = "消息类型(1:文本, 2:图片, 3:语音等)")
    @TableField("message_type")
    private Integer messageType;

    @Schema(description = "消息内容")
    @TableField("context")
    private String context;

    @Schema(description = "是否已读(0:未读, 1:已读)")
    @TableField("is_read")
    private Integer isRead;

    @Schema(description = "是否撤回(0:否, 1:是)")
    @TableField("is_recalled")
    private Integer isRecalled;

    @Schema(description = "消息发送时间")
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime; // 自动填充

    @Schema(description = "消息更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime; // 自动填充

    @Schema(description = "消息发送时间戳")
    @TableField("timestamp")
    private Long timestamp;
}
